package com.crazymaker.springcloud.user.info.controller;

import com.crazymaker.springcloud.base.service.SysUserServiceImpl;
import com.crazymaker.springcloud.common.dto.UserDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Api(value = "用户信息、基础学习DEMO", tags = {"用户信息DEMO"})
@RestController
@RequestMapping("/api/user")
public class UserController {

    @Autowired
    private SysUserServiceImpl userService;

    @GetMapping("/detail/v1")
    @ApiOperation(value = "获取用户信息")
    public ResponseEntity<UserDTO> getUser(@RequestParam(value = "userId", required = true) Long userId) {
        UserDTO user = userService.getUser(userId);
        return ResponseEntity.ok(user);
    }
}
